﻿using Quartz;
using SUNRPA.CONTROLS.IMPL.util;
using System.Windows;

namespace SUNRPA.CONTROLS.IMPL.domain.quartz {
    [DisallowConcurrentExecution]
    public class FlowExeJob:IJob {
        public static LogUtil logger = new LogUtil(typeof(FlowExeJob));
        public Task Execute(IJobExecutionContext context) {
            return Task.Run(() => {
                ProcessInfo processInfo = context.JobDetail.JobDataMap["processInfo"] as ProcessInfo;
                Window window = context.JobDetail.JobDataMap["mainWindow"] as Window;
                logger.Info("开始运行流程:{ProcessName}，触发器执行，触发器名称：{TriggerName}", processInfo.processName, context.Trigger.Key);
                window.Dispatcher.Invoke(() => {
                    FrontUiDelegateUtil.ExeProcessDel(processInfo, window);
                });
            });
        }
    }
}
